From: Allen Kay Date: Thu, 23 Jun 2011 10:11:24 +0000 (+0100) Subject: [VTD] print out debug message in vt-d fault handler only when iommu=debug is set X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10131^2~5 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=66b29760bc32964308a5dcd5d8b0d75930d0bff8;p=xen.git [VTD] print out debug message in vt-d fault handler only when iommu=debug is set Print out debug messages in vtd_page_fault() handler only when iommu=debug is set xen boot parameter. Signed-off-by: Allen Kay --- diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c index 84e246f7a1..332537953b 100644 --- a/xen/drivers/passthrough/amd/iommu_acpi.c +++ b/xen/drivers/passthrough/amd/iommu_acpi.c @@ -817,7 +817,7 @@ static int __init parse_ivrs_table(struct acpi_table_header *_table) BUG_ON(!table); - if ( amd_iommu_debug ) + if ( iommu_debug ) dump_acpi_table_header(table); /* parse IVRS blocks */ diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index cd8d10a363..1e141a6227 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -48,7 +48,7 @@ bool_t __read_mostly iommu_snoop = 1; bool_t __read_mostly iommu_qinval = 1; bool_t __read_mostly iommu_intremap = 1; bool_t __read_mostly iommu_hap_pt_share; -bool_t __read_mostly amd_iommu_debug; +bool_t __read_mostly iommu_debug; bool_t __read_mostly amd_iommu_perdev_intremap; static void __init parse_iommu_param(char *s) @@ -74,8 +74,8 @@ static void __init parse_iommu_param(char *s) iommu_qinval = 0; else if ( !strcmp(s, "no-intremap") ) iommu_intremap = 0; - else if ( !strcmp(s, "amd-iommu-debug") ) - amd_iommu_debug = 1; + else if ( !strcmp(s, "debug") ) + iommu_debug = 1; else if ( !strcmp(s, "amd-iommu-perdev-intremap") ) amd_iommu_perdev_intremap = 1; else if ( !strcmp(s, "dom0-passthrough") ) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index a8d806ba78..23c6f2f1eb 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -818,7 +818,7 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type, if ( fault_type == DMA_REMAP ) { - dprintk(XENLOG_WARNING VTDPREFIX, + INTEL_IOMMU_DEBUG( "DMAR:[%s] Request device [%02x:%02x.%d] " "fault addr %"PRIx64", iommu reg = %p\n" "DMAR:[fault reason %02xh] %s\n", @@ -827,12 +827,13 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type, PCI_FUNC(source_id & 0xFF), addr, iommu->reg, fault_reason, reason); #ifndef __i386__ /* map_domain_page() cannot be used in this context */ - print_vtd_entries(iommu, (source_id >> 8), + if (iommu_debug) + print_vtd_entries(iommu, (source_id >> 8), (source_id & 0xff), (addr >> PAGE_SHIFT)); #endif } else - dprintk(XENLOG_WARNING VTDPREFIX, + INTEL_IOMMU_DEBUG( "INTR-REMAP: Request device [%02x:%02x.%d] " "fault index %"PRIx64", iommu reg = %p\n" "INTR-REMAP:[fault reason %02xh] %s\n", @@ -846,26 +847,19 @@ static int iommu_page_fault_do_one(struct iommu *iommu, int type, static void iommu_fault_status(u32 fault_status) { if ( fault_status & DMA_FSTS_PFO ) - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_fault_status: Fault Overflow\n"); + INTEL_IOMMU_DEBUG("iommu_fault_status: Fault Overflow\n"); if ( fault_status & DMA_FSTS_PPF ) - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_fault_status: Primary Pending Fault\n"); + INTEL_IOMMU_DEBUG("iommu_fault_status: Primary Pending Fault\n"); if ( fault_status & DMA_FSTS_AFO ) - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_fault_status: Advanced Fault Overflow\n"); + INTEL_IOMMU_DEBUG("iommu_fault_status: Advanced Fault Overflow\n"); if ( fault_status & DMA_FSTS_APF ) - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_fault_status: Advanced Pending Fault\n"); + INTEL_IOMMU_DEBUG("iommu_fault_status: Advanced Pending Fault\n"); if ( fault_status & DMA_FSTS_IQE ) - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_fault_status: Invalidation Queue Error\n"); + INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Queue Error\n"); if ( fault_status & DMA_FSTS_ICE ) - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_fault_status: Invalidation Completion Error\n"); + INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Completion Error\n"); if ( fault_status & DMA_FSTS_ITE ) - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_fault_status: Invalidation Time-out Error\n"); + INTEL_IOMMU_DEBUG("iommu_fault_status: Invalidation Time-out Error\n"); } #define PRIMARY_FAULT_REG_LEN (16) diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h index e75b24fb67..65cd703c1e 100644 --- a/xen/drivers/passthrough/vtd/iommu.h +++ b/xen/drivers/passthrough/vtd/iommu.h @@ -512,4 +512,11 @@ struct intel_iommu { struct acpi_drhd_unit *drhd; }; +#define INTEL_IOMMU_DEBUG(fmt, args...) \ + do \ + { \ + if ( iommu_debug ) \ + dprintk(XENLOG_WARNING VTDPREFIX, fmt, ## args); \ + } while(0) + #endif diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h index 10d6cc93d4..b14e387538 100644 --- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h @@ -35,7 +35,7 @@ #define AMD_IOMMU_DEBUG(fmt, args...) \ do \ { \ - if ( amd_iommu_debug ) \ + if ( iommu_debug ) \ printk(XENLOG_INFO "AMD-Vi: " fmt, ## args); \ } while(0) diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 31476c20c1..d4c94d0c16 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -31,7 +31,7 @@ extern bool_t force_iommu, iommu_verbose; extern bool_t iommu_workaround_bios_bug, iommu_passthrough; extern bool_t iommu_snoop, iommu_qinval, iommu_intremap; extern bool_t iommu_hap_pt_share; -extern bool_t amd_iommu_debug; +extern bool_t iommu_debug; extern bool_t amd_iommu_perdev_intremap; extern struct rangeset *mmio_ro_ranges;